let https = require("https");
const options = {
    hostname:"apimusic.linweiqin.com",
    port:443,
    method:"GET",
    path:"/search?keywords=music"
}
//返回的数据
let responseData = "";
let request = https.request(options,(res)=>{
    res.on("data",(data)=>{
        responseData+=data;
    })
    res.on("error",function(err){
        console.log(err);
    })
    res.on("end",function(){
        //console.log(responseData);
        //获取到数据转对象然后获取对象下面的result下面的songs 遍历歌单数组
        JSON.parse(responseData).result.songs.map((v,i)=>{
            console.log(v);
        })
        console.log("数据已经加载完毕");
    })
})
request.end();